package org.dh2580.dev.tools.util;

import java.util.Objects;

/**
 * 数字工具类
 *
 * @Author: hao.deng
 * @Date: 2018/11/29-上午10:08
 */
public final class NumberUtil {
    private NumberUtil() {
    }

    public static boolean allGt(long target, long... args) {
        Objects.requireNonNull(args, "args cannot be null");

        for (long arg : args) {
            if (arg <= target) {
                return false;
            }
        }
        return true;
    }

    public static boolean anyGt(long target, long... args) {
        Objects.requireNonNull(args, "args cannot be null");

        for (long arg : args) {
            if (arg > target) {
                return true;
            }
        }
        return false;
    }

    public static boolean nonGt(long target, long... args) {
        return !anyGt(target, args);
    }

    public static boolean allGte(long target, long... args) {
        Objects.requireNonNull(args, "args cannot be null");

        for (long arg : args) {
            if (arg < target) {
                return false;
            }
        }
        return true;
    }

    public static boolean anyGte(long target, long... args) {
        Objects.requireNonNull(args, "args cannot be null");

        for (long arg : args) {
            if (arg >= target) {
                return true;
            }
        }
        return false;
    }

    public static boolean nonGte(long target, long... args) {
        return !anyGte(target, args);
    }

    public static boolean allLt(long target, long... args) {
        Objects.requireNonNull(args, "args cannot be null");

        for (long arg : args) {
            if (arg >= target) {
                return false;
            }
        }
        return true;
    }

    public static boolean anyLt(long target, long... args) {
        Objects.requireNonNull(args, "args cannot be null");

        for (long arg : args) {
            if (arg < target) {
                return true;
            }
        }
        return false;
    }

    public static boolean nonLt(long target, long... args) {
        return !anyLt(target, args);
    }

    public static boolean allLte(long target, long... args) {
        Objects.requireNonNull(args, "args cannot be null");

        for (long arg : args) {
            if (arg > target) {
                return false;
            }
        }
        return true;
    }

    public static boolean anyLte(long target, long... args) {
        Objects.requireNonNull(args, "args cannot be null");

        for (long arg : args) {
            if (arg <= target) {
                return true;
            }
        }
        return false;
    }

    public static boolean nonLte(long target, long... args) {
        return !anyLte(target, args);
    }
}
